// pages/my/myzixun/myzixun.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    select:false,
    consultants:[
        {
          picture:"/images/zxs03.jpg",
          name: '王大国',
          startTime: '2019-5-8 11:00',
          endTime: '2019-5-8 12:00',
          evaluated: true,
          pingjia:"请评价"
        },
        {
            picture:"/images/zxs04.jpg",
          name: '刘备',
          evaluated: false
        },
        {
            picture:"/images/zxs06.jpg",
          name: '张飞',
          evaluated: false
        },
        {
            picture:"/images/zxs02.jpg",
          name: '王玉露',
          startTime: '2019-5-8 11:00',
          endTime: '2019-5-8 12:00',
          evaluated: true,
          pingjia:"已评价"
        }],
        completedConsultants: [],
        incompleteConsultants: []
  },
  top() {
    this.setData({
        select: !this.data.select
    })
},
sortConsultants: function() {
    const { consultants } = this.data;
    const completed = [];
    const incomplete = [];

    consultants.forEach(consultant => {
      if (consultant.evaluated) {
        completed.push(consultant);
      } else {
        incomplete.push(consultant);
      }
    });

    this.setData({
      completedConsultants: completed,
      incompleteConsultants: incomplete
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.sortConsultants();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})